package com.talking.activities.main
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.activity.result.ActivityResult
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.app.ActivityOptionsCompat
import androidx.fragment.app.Fragment
import com.talking.activities.SearchActivity
import com.talking.databinding.FragmentMessageBinding
class MessageFragment : Fragment() {
    private lateinit var launcher: ActivityResultLauncher<Intent>
    private lateinit var act: MainActivity
    private lateinit var binding: FragmentMessageBinding
    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
        binding = FragmentMessageBinding.inflate(inflater, container, false)
        act= requireActivity() as MainActivity
        binding.msgSearch.setOnClickListener {
            launcher.launch(Intent(act, SearchActivity::class.java), ActivityOptionsCompat.makeSceneTransitionAnimation(act, binding.msgSearch, "search"))
        }
        launcher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->

        }
        return binding.root
    }
}